home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / AMOSList / AMOSLIST / text0234.txt < prev    next >
Encoding:
Text File  |  1998-04-01  |  2.5 KB  |  129 lines

  1. Could you help me with this one:
  2.  
  3. I need a fast line drawing routine for my next game (faster than on any extensions). 
  4. I have tried to do it on my own but failed more than once. I found routine called 
  5. "Simpleline" from the "Amiga Hardware Reference Manual", I have compiled it and tried 
  6. to use it with Amos, but nothing will happen:(((
  7.  
  8. The routine needs following values:
  9. D0/D1 = X1/Y1
  10. D2/D3 = X2/Y2
  11. D4 = Planewidth in bytes
  12. A0 = Planepointer
  13.  
  14. I'm using a following program:
  15.  
  16. Screen Open 0,320,200,16,Lowres
  17. Cls 0
  18. PLoad "simpleline",10 
  19. DReg(0)=1:Dreg(1)=1:Dreg(2)=200:Dreg(3)=100:Dreg(4)=40:Areg(0)=Phybase(0)
  20. Call 10
  21.  
  22. Timer shows that something happens but there are no line on a screen.
  23. It may be a little stupid thing I do wrong and I may be stupid for not 
  24. noticing it. This thing drives me mad. So I beg you, please help (It 
  25. ain't nice to be stupid and mad at the same time). 
  26.  
  27. I've included the asm source for you to look at. Sorry for the length, 
  28. I promise I won't bother you anymore... 
  29.  
  30.     include    "Work:Sources/Exec/types.i"
  31.     include "Work:Sources/Hardware/custom.i"
  32.     include "Work:Sources/Hardware/blit.i"
  33.     include "Work:Sources/Hardware/dmabits.i
  34.  
  35.     xref    _custom
  36.     xdef    simpleline
  37.     
  38. simpleline:
  39.     lea    _custom,a1
  40.     sub.w    d0,d2
  41.     bmi    xneg
  42.     sub.w    d1,d3
  43.     bmi     yneg
  44.     cmp.w    d3,d2
  45.     bmi    ygtx
  46.     moveq.l    #OCTANT1+LINEMODE,d5
  47.     bra    lineagain
  48. ygtx:
  49.     exg    d2,d3
  50.     moveq.l    #OCTANT2+LINEMODE,d5
  51.     bra    lineagain
  52. yneg:
  53.     neg.w    d3
  54.     cmp.w    d3,d2
  55.     bmi    ynygtx
  56.     moveq.l    #OCTANT8+LINEMODE,d5
  57.     bra     lineagain
  58. ynygtx:
  59.     exg    d2,d3
  60.     moveq.l    #OCTANT7+LINEMODE,d5
  61.     bra    lineagain
  62. xneg:
  63.     neg.w    d2
  64.     sub.w    d1,d3
  65.     bmi    xyneg
  66.     cmp.w    d3,d2
  67.     bmi    xnygtx
  68.     moveq.l    #OCTANT4+LINEMODE,d5
  69.     bra    lineagain
  70. xnygtx:
  71.     exg    d2,d3
  72.     moveq.l    #OCTANT3+LINEMODE,d5
  73.     bra     lineagain
  74. xyneg:
  75.     neg.w    d3
  76.     cmp.w    d3,d2
  77.     bmi    xynygtx
  78.     moveq.l    #OCTANT5+LINEMODE,d5
  79.     bra     lineagain
  80. xynygtx:
  81.     exg    d2,d3
  82.     moveq.l    #OCTANT6+LINEMODE,d5
  83. lineagain:
  84.     mulu.w    d4,d1
  85.     ror.l    #4,d0
  86.     add.w    d0,d0
  87.     add.l    d1,a0
  88.     add.w    d0,a0
  89.     swap    d0
  90.     or.w    #$bfa,d0
  91.     lsl.w    #2,d3
  92.     add.w    d2,d2
  93.     move.w    d2,d1
  94.     lsl.w    #5,d1
  95.     add.w    #$42,d1
  96.     btst    #DMAB_BLTDONE-8,dmaconr(a1)
  97. waitblit:
  98.     btst    #DMAB_BLTDONE-8,dmaconr(a1)
  99.     bne    waitblit
  100.     move.w     d3,bltbmod(a1)
  101.     sub.w    d2,d3
  102.     ext.l    d3
  103.     move.l    d3,bltapt(a1)
  104.     bpl    lineover
  105.     or.w    #SIGNFLAG,d5
  106. lineover:
  107.     move.w    d0,bltcon0(a1)
  108.     move.w    d5,bltcon1(a1)
  109.     move.w    d4,bltcmod(a1)
  110.     move.w    d4,bltdmod(a1)
  111.     sub.w    d2,d3
  112.     move.w    d3,bltamod(a1)
  113.     move.w    #$8000,bltadat(a1)
  114.     moveq.l    #-1,d5
  115.     move.l    d5,bltafwm(a1)
  116.     move.l    a0,bltcpt(a1)
  117.     move.l    a0,bltdpt(a1)
  118.     move.w    d1,bltsize(a1)
  119.     rts
  120.     end
  121.  
  122. SLin   
  123.     
  124.      
  125.  
  126.  
  127.  
  128.  
  129.